package s06;

import base.Bean2;
import net.sf.cglib.beans.ImmutableBean;

/**
 * @author wangpp
 */
public class ImmutableBeanTest {
    public static void main(String[] args) {
        Bean2 bean2 = new Bean2();

        bean2.setValue("1111111");

        Bean2 cantChangBean = (Bean2) ImmutableBean.create(bean2);

        //
        System.out.println(cantChangBean.getValue());

        //
        bean2.setValue("22222");
        System.out.println(cantChangBean.getValue());


        //
//        cantChangBean.setValue("33333"); //Exception in thread "main" java.lang.IllegalStateException: Bean is immutable
//        System.out.println(cantChangBean.getValue());

    }
}
